package com.cyclinggle.cloud.service.impl;

import org.springframework.stereotype.Component;

import com.cyclinggle.cloud.service.UserService;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;

@Component
public class UserServiceImpl implements UserService {

	@Override
	@HystrixCommand(fallbackMethod = "defaultUser")
	public String getUser(String username) throws Exception {
		if (username.equals("spring")) {
			return "This is real User";
		}
		throw new Exception();
	}
	
	public String defaultUser(String username) {
		return "The user does not exist in this system";
	}

}
